#include <stdio.h>   /*预处理*/
#include <ctype.h>   /*调用toupper函数*/

int main()     /*主函数*/
{
    double faHeight,moHeight,geneticHeight,Height;     /*定义变量*/
    char sex,sports,diet,F='F',M='M',N='N',Y='Y';

    printf("Please input your father's height and mother's height:");
    scanf("%lf %lf",&faHeight,&moHeight);    /*注意double类型在scanf函数中的格式说明字符是%lf*/
    printf("Please input your sex(F/M):");
    scanf(" %c",&sex);    /*注意在格式说明符之前加空格清除缓冲区*/
    sex = toupper(sex);
    if(sex == 'F')    /*判断*/
    {
        geneticHeight=(faHeight*0.923+moHeight)/2;
    }
    else if(sex == 'M')
    {
        geneticHeight=(faHeight+moHeight)*0.54;
    }
    else
    {
        printf("ERROR");
    }
    printf("Do you like sports(Y/N):");
    scanf(" %c",&sports);
    sports = toupper(sports);
    printf("Do you like healthy diet(Y/N):");
    scanf(" %c",&diet);
    diet = toupper(diet);

    if((sports == 'Y')&&(diet == 'Y'))   /*列出四种情况*/
    {
        Height=geneticHeight*(1+0.02+0.015);
        printf("Your height will be %.2f",Height);
    }
    else if((sports == 'Y')&&(diet == 'N'))
    {
        Height=geneticHeight*(1+0.02);
        printf("Your height will be %.2f",Height);
    }
    else if((sports == 'N')&&(diet == 'Y'))
    {
        Height=geneticHeight*(1+0.015);
        printf("Your height will be %.2f",Height);
    }
    else if((sports == 'N')&&(diet == 'N'))
    {
        Height=geneticHeight;
        printf("Your height will be %.2f",Height);
    }
    else
    {
        printf("ERROR");
    }
    
    
    return 0;

}